﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;










#region Developers Reference

///<errors>
///Getting error 'Neural_Network.Neuron' Does not implement
///interface member 'Neural_Network.INeuron.AxonOutput()'
///etc. assuming that its just a small error
///that will get fixed soon ;P
///</errors>










///<solution>
///was able to fix it + run the project by replacing
///Neuron : INeuron with Neuro but decided
///that i didn't understand the code enough to do that
///
///Update:27th February,2011
///It was my mistake, inharited interface members should be public
///</solution>

/// <theory>
/// The theory of neural network is quiet different than my implimentation
/// I'll use iteration in a way, so that each neuron will process a bit of information
/// The more neurons we will use, the more accurate the learnt knowledge will be
/// *******************************************************************************************
/// So far i have read, if the weighted total cross the bias, the neuron should activate itself
/// No one told about, how much will be the output? does it depend on the total weight? or the
/// output is something like true/false.
/// *******************************************************************************************
/// Some neurons might have differential bias
/// some neuron might have proportional bias
/// 
/// Bias will be adjasted to create the function, inside the network
/// </theory>

#endregion

namespace Neural_Network
{
    ///<question>
    ///put some stuff after dendrite input
    ///is it right? if not plz change it 
    ///and forgive me ;P
    ///</question>
    /// <summary>
    /// Different type of neuron's might need to be created later therefore
    /// I am creating a common interface
    /// </summary>
    interface INeuron
    {
        /// <summary>
        /// Set the next level neurons
        /// </summary>
        /// <param name="Neuron"></param>
        void PlaceAxonOn(INeuron Neuron);

        /// <summary>
        /// Set the previous level neurons
        /// </summary>
        /// <param name="Neuron"></param>
        void DendriteLockedBy(INeuron Neuron);

        /// <summary>
        /// Input passed by previous Neurons through their axon
        /// </summary>
        /// <param name="value"></param>
        void DendriteInput(float value);

        /// <summary>
        /// After the reception of all inputs, weight is calculated and if it excceeds the bias
        /// simply triger the axon
        /// </summary>
        void AxonOutput();
    }

    /// <summary>
    /// Is the basic eliment of neural network
    /// </summary>
    class Neuron : INeuron
    {
        List<INeuron> AxonPlacedOn;
        List<INeuron> AxonPlacedBy;//Dendrite locked by

        /// <summary>
        /// Constractor of the Neuron class
        /// </summary>
        public Neuron()
        {
            AxonPlacedOn = new List<INeuron>();
            AxonPlacedBy = new List<INeuron>();
        }

        /// <summary>
        /// Set the next level neurons
        /// </summary>
        /// <param name="Neuron"></param>
        public void PlaceAxonOn(INeuron Neuron)
        {
        }

        /// <summary>
        /// Set the previous level neurons
        /// </summary>
        /// <param name="Neuron"></param>
        public void DendriteLockedBy(INeuron Neuron)
        {
        }

        /// <summary>
        /// Input passed by previous Neurons through their axon
        /// </summary>
        /// <param name="value"></param>
        public void DendriteInput(float value)
        {
        }
        /// <summary>
        /// After the reception of all inputs, weight is calculated and if it excceeds the bias
        /// simply triger the axon
        /// </summary>
        public void AxonOutput()
        {
        }

    }

}
